﻿@model KL.Store.Web.Models.CategoryModel
@using KL.Store.Core
@{
    Layout = null;
    string categoryListFullCssClass = "col-xs-12 col-sm-12 col-md-9 col-lg-10 right";
    if (Parameters.Theme == "JB")
    {
        categoryListFullCssClass = "col-xs-12 col-sm-12 col-md-12 col-lg-12 first last";
    }
    else if (Parameters.Theme == "DK")
    {
        categoryListFullCssClass = "col-xs-12 col-sm-12 col-md-8 col-lg-9 first last";
    }
    else if (Parameters.Theme == "EO")
    {
        categoryListFullCssClass = "col-xs-12 col-sm-12 col-md-8 col-lg-9 first last";
    }

    string categoryListColumnCssClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
    if (Parameters.CategoryListColumnCount == 1)
    {
        categoryListColumnCssClass = "col-xs-6 col-sm-6 col-md-12 col-lg-12";
    }
    else if (Parameters.CategoryListColumnCount == 2)
    {
        categoryListColumnCssClass = "col-xs-6 col-sm-6 col-md-6 col-lg-6";
    }
    else if (Parameters.CategoryListColumnCount == 3)
    {
        categoryListColumnCssClass = "col-xs-6 col-sm-6 col-md-4 col-lg-4";
    }
    else if (Parameters.CategoryListColumnCount == 4)
    {
        categoryListColumnCssClass = "col-xs-6 col-sm-6 col-md-3 col-lg-3";
    }
    else if (Parameters.CategoryListColumnCount == 6)
    {
        categoryListColumnCssClass = "col-xs-6 col-sm-6 col-md-3 col-lg-2";
    }
    else
    {
        categoryListColumnCssClass = "col-xs-6 col-sm-6 col-md-4 col-lg-3";
    }
    if (Parameters.Theme == "DK")
    {
        categoryListColumnCssClass = "col-xs-6 col-sm-6 col-md-3 col-lg-3";
    }
}
@if (Model.RelatedCategories.Count() > 0)
{
    <h2 class="brand-category-title">Kategoriler</h2>
}
<div class="categories">
    <ul>
        @{ var categoryCounter = 1;
           var categoryListCssClass = ""; }
        @foreach (var item in Model.RelatedCategories)
        {
            if (item.RelatedCategoryCount <= 0 && item.RelatedItemCount <= 0)
            {
                continue;
            }
            if (categoryCounter % Parameters.CategoryListColumnCount == 0)
            {
                categoryListCssClass = "inLastColumn";
            }
            else
            {
                categoryListCssClass = "";
            }
            <li class="@categoryListColumnCssClass @categoryListCssClass">
                @if (item.RelatedCategoryCount > 0)
                {
                    <div class="category-outer">
                        <div class="category-inner">
                            <div class="category-image">
                                <a id="ct_@item.CategoryId" class="cgLink" href="@item.LinkUrl">
                                    <img id="ic_@item.CategoryId" src="@(Parameters.WebSiteImageUrl)/category/@(item.CategoryId).jpg" alt="@item.CategoryName" />
                                    <div class="incele">İncele</div>
                                </a>
                            </div>
                            <div class="category-title">
                                <a id="cl_@item.CategoryId" class="cgLink" href="@item.LinkUrl">@item.CategoryName</a>
                            </div>
                        </div>
                    </div>
                }
                else
                {
                    <div class="category-outer">
                        <div class="category-inner">
                            <div class="category-image">
                                <a id="pr_@item.CategoryId" class="prLink" href="@item.LinkUrl">
                                    <img id="ip_@item.CategoryId" src="@(Parameters.WebSiteImageUrl)/category/@(item.CategoryId).jpg" alt="@item.CategoryName" />
                                    <div class="incele">İncele</div>
                                </a>
                            </div>
                            <div class="category-title">
                                <a id="pl_@item.CategoryId" class="prLink" href="@item.LinkUrl">@(item.CategoryName)
                                    @if (Parameters.Theme == "HA")
                                    {
                                        <br />
                                        if (item.RelatedItemCount > 0)
                                        { 
                                        @(item.RelatedItemCount) <span class="productFound">ürün bulunuyor</span>                                            }
                                        else
                                        {
                                        <text>(Ürün yok)</text>
                                        }
                                    }
                                    else
                                    {
                                        if (item.RelatedItemCount > 0)
                                        { 
                                        <text>(</text>@(item.RelatedItemCount)<text>)</text>
                                        }
                                        else
                                        {
                                        <text>(Ürün yok)</text>
                                        }
                                    }
                                </a>
                            </div>
                        </div>
                    </div>
                }
            </li>
                categoryCounter++;
        }
    </ul>
    <div class="clearfix"></div>
</div>
<div class="clearfix"></div>
